package com.zlzxm.studentscreen.net.http;


import android.util.Log;

import retrofit2.Retrofit;

public class RetrofitClient {

    public static String TAG  =  "RetrofitClient";

    public static String BASE_URL = "https://www.baidu.com/";


    private static Retrofit RETROFIT = null;


    private RetrofitClient(){

    }

    public static Retrofit get(){

        if(RETROFIT == null){

            RETROFIT = RetrofitCreator.creatorWithGsonSupportRx(BASE_URL);

        }

        return RETROFIT;
    }


    public static void reSet(String server){

        BASE_URL =  server;

        Log.e(TAG,"server : " + server);

        RETROFIT = RetrofitCreator.creatorWithGsonSupportRx(BASE_URL);

    }

    public  static  <T>T  create(Class<T> service){

        if(RETROFIT == null) {

            get();
        }

        return RETROFIT.create(service);
    }


}
